package com.ruoyi.web.controller.teaching;


import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.teaching.domain.PlatformDDraw;
import com.ruoyi.teaching.service.PlatformDDrawService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 王旭
 * @since 2025-01-10
 */
@RestController
@RequestMapping("/platform/draw")
@Api(tags = "platform-画板管理")
public class PlatformDDrawController {
    @Autowired
    private PlatformDDrawService platformDDrawService;

    /**
     * 查询我的所有画板
     */
    @GetMapping("/drawList")
    @ApiOperation(value = "查询我的所有画板", notes = "查询我的所有画板")
    public AjaxResult drawList(Integer pageNum, Integer pageSize) {
        return platformDDrawService.drawList(pageNum, pageSize);
    }

    /**
     * 查询某个画板详情
     */
    @GetMapping("/detailDraw")
    @ApiOperation(value = "查询某个画板详情", notes = "查询某个画板详情")
    public AjaxResult detailDraw(Long id) {
        return platformDDrawService.detailDraw(id);
    }

    /**
     * 新增/修改画板
     */
    @PostMapping("/addOrUpdateDraw")
    @ApiOperation(value = "新增/修改画板", notes = "新增/修改画板")
    @Log(title = "【新增/修改画板】", businessType = BusinessType.OTHER)
    public AjaxResult addOrUpdateDraw(@RequestBody PlatformDDraw platformDDraw) {
        return platformDDrawService.addOrUpdateDraw(platformDDraw);
    }

    /**
     * 删除画板
     */
    @DeleteMapping("/deleteDraw")
    @ApiOperation(value = "删除画板", notes = "删除画板")
    @Log(title = "【删除画板】", businessType = BusinessType.DELETE)
    public AjaxResult deleteDraw(Long id) {
        return platformDDrawService.deleteDraw(id);
    }

}

